<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>超期物料汇总表</title>
    <link rel="stylesheet" href="/3nod_web/layui/css/layui.css" media="all">
</head>
<body>
<div id="content">
    <h1>超期物料汇总表</h1>
    <div class="layui-form-item" style="margin-top: 20px">
        <div class="layui-inline">
            <label class="layui-form-label">据点</label>
            <div class="layui-input-inline" style="width:168px;">
                <input type="text" name="storerkey" id="storerkey" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">品号</label>
            <div class="layui-input-inline" style="width:168px;">
                <input type="text" name="sku" id="sku" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">供应商</label>
            <div class="layui-input-inline" style="width:168px;">
                <input type="text" name="lottable02" id="lottable02" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">存储期限</label>
            <div class="layui-input-inline" style="width:168px;">
                <input type="text" name="shelflifeonreceiving" id="shelflifeonreceiving" autocomplete="off" class="layui-input">
            </div>
        </div>
    </div>
    <table class="layui-hide" id="demo" lay-filter="demo"></table>
</div>


<script src="/3nod_web/layui/layui.js" charset="utf-8"></script>
<script src="/3nod_web/js/jquery-1.8.3.js" charset="utf-8"></script>
<script type="text/html" id="xuhao">
    {{d.LAY_TABLE_INDEX+1}}
</script>
<script>
    layui.use('table', function () {
        var table = layui.table;

        //方法级渲染
        table.render({
            elem: '#demo'
            , url: '/3nod_web/lotxlocxid/list/'
            , cellMinWidth: 150
            , cols: [
                [
                    {templet: '#xuhao', title: '序号', width: 65, fixed: true}
                    , {field: 'storerkey', title: '据点', sort: true, fixed: true, width: 80}
                    , {field: 'sku', title: '品号'}
                    , {field: 'descr', title: '品名'}
                    , {field: 'default6', title: '规格'}
                    , {field: 'lottable01', title: '逻辑仓'}
                    , {field: 'loc', title: '库位'}
                    , {field: 'qty', title: '数量'}
                    , {field: 'lottable02', title: '供应商'}
                    , {field: 'adddate', title: '质检日期'}
                    , {field: 'lottable04', title: '制造日期'}
                    , {field: 'shelflifeonreceiving', title: '存储期限（天）'}
                    , {field: 'extraDays', title: '超期天数'}
                ]
            ]
            , limits: [20, 50, 100, 200, 500, 1000, 2000, 3000, 4000, 5000]
            , limit: 20
            , id: 'testReload'
            , height: 'full-180'
            , page: true
        });

        var $ = layui.$, active = {
            reload: function () {
                var storerkey = $('#storerkey');
                var sku = $('#sku');
                var lottable02 = $('#lottable02');
                var shelflifeonreceiving = $('#shelflifeonreceiving');

                //执行重载
                table.reload('testReload', {
                    page: {
                        curr: 1 //重新从第 1 页开始
                    }
                    , where: {
                        storerkey: storerkey.val(),
                        sku: sku.val(),
                        lottable02: lottable02.val(),
                        shelflifeonreceiving: shelflifeonreceiving.val(),
                    }
                }, 'data');
            }
        };

        //按回车提交
        $(".layui-input-inline").keydown(function (e) {//当按下按键时
            if (e.which == 13) {//.which属性判断按下的是哪个键，回车键的键位序号为13
                // $('button.search123').trigger("click");//触发搜索按钮的点击事件
                active['reload'] ? active['reload'].call(this) : '';
            }
        });
    });
</script>

</body>
</html>